<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action {

    public function index(){
		Load('extend');
		$News =   M('News');
		//焦点图5条新闻
		$IndexArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb,v9_position_data.* FROM `v9_news` 
left join `v9_position_data` on  `v9_news`.id=`v9_position_data`.id  WHERE v9_news.title!='' AND v9_news.thumb!='' AND v9_position_data.posid =1 order by `v9_news`.id desc limit 0,5");

		//3条头部新闻
		$HeadArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb,v9_position_data.* FROM `v9_news` 
left join `v9_position_data` on  `v9_news`.id=`v9_position_data`.id  WHERE  v9_news.title!='' AND v9_position_data.posid =2 order by `v9_news`.id desc limit 0,3");

		//头部中间的8条新闻
		$HeadEightArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb,v9_position_data.* FROM `v9_news` 
left join `v9_position_data` on  `v9_news`.id=`v9_position_data`.id  WHERE  v9_news.thumb='' AND v9_news.title!='' AND v9_position_data.posid =2 order by `v9_news`.id desc limit 0,8");
		
		//新闻快报
		$IndexKuaiArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb,v9_position_data.* FROM `v9_news` 
left join `v9_position_data` on  `v9_news`.id=`v9_position_data`.id  WHERE  v9_news.thumb!='' AND v9_position_data.posid !=1 AND v9_position_data.posid !=2  order by `v9_news`.id desc limit 0,3");

		
		//最新10条新闻
		$NewTopArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb,v9_position_data.* FROM `v9_news` 
left join `v9_position_data` on  `v9_news`.id=`v9_position_data`.id  WHERE v9_news.title!='' AND v9_position_data.posid !=1 AND v9_position_data.posid !=2  order by `v9_news`.id desc limit 0,10");

		//国际动态10条
		$GuojiNewsListArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=759 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,26");

		$GuojiTopArr = array_slice($GuojiNewsListArr,0,10);
		
		//市场观察10条
		$ShichangTopArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=760 AND v9_news.title!=''  order by `v9_news`.id desc limit 0,10");

		//热点图片-图片新闻4条
		$HotImgNewsListArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=767 AND v9_news.title!='' AND v9_news.thumb!='' order by `v9_news`.id desc limit 3,20");
		$HotImgArr = array_slice($HotImgNewsListArr,0,4);

		//左边企业新闻12条
		$QiyiNewsListArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=769 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,23");
		$CompanyListArr = array_slice($QiyiNewsListArr,0,12);

		//左边科技创新12条
		$KejiNewsListArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=762 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,20");
		$KejiListArr = array_slice($KejiNewsListArr,0,12);

		//左边行业知识12条
		$HangyeNewsLisArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=764 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,28");
		$HangyeLisArr = array_slice($HangyeNewsLisArr,0,12);
		
		//中间图片展示1条
		$HeadOneCenterArr = $News->query("SELECT `v9_news`.url,`v9_news`.title,`v9_news`.inputtime,`v9_news`.description as adescription,v9_news.thumb as newsthumb FROM `v9_news` 
left join `v9_position_data` on  `v9_news`.id=`v9_position_data`.id  WHERE v9_news.title!='' AND v9_news.thumb!='' AND v9_position_data.posid =1 order by `v9_news`.id desc limit 5,1");

		//中间行业新闻8条
		$HangyeNewsListArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=758 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,34");
		$HangyeCenterArr = array_slice($HangyeNewsListArr,0,8);
		
		//中间科技创新8条
		//$KejiCenterArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=762 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,8");
		$KejiCenterArr = array_slice($KejiNewsListArr,12,8);

		//中间政策法规8条
		$ZhengcheCenterArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=770 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,8");

		//中间分析预测8条
		$FenxiCenterArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=761 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,8");

		//右边特别报道12条
		$BaodaoRightArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=768 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,12");



		//中间国际动态6条
		//$DongtaiSixArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=759 AND v9_news.title!='' AND v9_news.thumb!='' order by `v9_news`.id desc limit 10,6");
		$DongtaiSixArr = array_slice($GuojiNewsListArr,10,6);
		
		//中间图片新闻6条
		//$TupianSixArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=767 AND v9_news.title!='' AND v9_news.thumb!='' order by `v9_news`.id desc limit 5,6");
		$TupianSixArr = array_slice($HotImgNewsListArr,4,6);

		//中间导购评测6条
		$DaogouNewsListArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=765 AND v9_news.title!='' AND v9_news.thumb!='' order by `v9_news`.id desc limit 0,16");
		$DaogouSixArr = array_slice($DaogouNewsListArr,0,6);

		//中间行业知识6条
		//$ZhishiSixArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=764 AND v9_news.title!='' AND v9_news.thumb!='' order by `v9_news`.id desc limit 12,6");
		$ZhishiSixArr = array_slice($HangyeNewsLisArr,12,6);


		//中间国际动态10条
		//$DongtaiTenArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=759 AND v9_news.title!=''  order by `v9_news`.id desc limit 16,10");
		$DongtaiTenArr = array_slice($GuojiNewsListArr,16,10);
		
		//中间图片新闻10条
		//$TupianTenArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=767 AND v9_news.title!='' order by `v9_news`.id desc limit 15,10");
		$TupianTenArr = array_slice($HotImgNewsListArr,10,10);

		//中间导购评测10条
		//$DaogouTenArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=765 AND v9_news.title!=''  order by `v9_news`.id desc limit 10,10");
		$DaogouTenArr = array_slice($DaogouNewsListArr,6,10);

		//中间行业知识10条
		//$ZhishiTenArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=764 AND v9_news.title!='' order by `v9_news`.id desc limit 22,10");
		$ZhishiTenArr = array_slice($HangyeNewsLisArr,18,10);



		//右侧行业新闻-热门新闻15条
		//$HangyeHotRightTArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=758 AND v9_news.title!=''  order by `v9_news`.id desc limit 5,15");
		$HangyeHotRightTArr = array_slice($HangyeNewsListArr,8,15);

		
		

		//左侧最新10条供应产品
		$ProductListArr = $News->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE  v9_product.title!='' AND v9_product.thumb!='' order by `v9_product`.id desc limit 0,14");
		$TenProductArr = array_slice($ProductListArr,0,10);

		//右侧中间4条供应产品
		//$FourProductArr = $News->query("SELECT `v9_product`.*,v9_product.thumb as newsthumb FROM `v9_product`  WHERE v9_product.title!='' AND v9_product.thumb!='' order by `v9_product`.id desc limit 10,4");
		$FourProductArr = array_slice($ProductListArr,10,14);

		//随机当天一篇有图片的文章
		$RandOneArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.title!=''   AND v9_news.thumb!='' AND v9_news.catid!=767  order by `v9_news`.id desc limit 6,1");


		//中间行业新闻-热门新闻11条
		//$XinwenCenterArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=758 AND v9_news.title!=''  order by `v9_news`.id desc limit 27,11");
		$XinwenCenterArr = array_slice($HangyeNewsListArr,23,11);


		//中间企业新闻11条
		//$QiyeCenterArr = $News->query("SELECT `v9_news`.*,v9_news.thumb as newsthumb FROM `v9_news`  WHERE v9_news.catid=769 AND v9_news.title!=''  order by `v9_news`.id desc limit 17,11");
		$QiyeCenterArr = array_slice($QiyiNewsListArr,12,11);

		

		$this->assign('IndexArr',$IndexArr);
		$this->assign('IndexKuaiArr',$IndexKuaiArr);
		$this->assign('HeadArr',$HeadArr);
		$this->assign('HeadEightArr',$HeadEightArr);
		$this->assign('HeadArr',$HeadArr);
		$this->assign('NewTopArr',$NewTopArr);
		$this->assign('GuojiTopArr',$GuojiTopArr);
		$this->assign('ShichangTopArr',$ShichangTopArr);
		$this->assign('ShichangTopArr',$ShichangTopArr);
		$this->assign('HotImgArr',$HotImgArr);
		$this->assign('CompanyListArr',$CompanyListArr);
		$this->assign('KejiListArr',$KejiListArr);
		$this->assign('HangyeLisArr',$HangyeLisArr);
		
		$this->assign('HeadOneCenterArr',$HeadOneCenterArr);
		$this->assign('HangyeCenterArr',$HangyeCenterArr);
		$this->assign('KejiCenterArr',$KejiCenterArr);
		$this->assign('ZhengcheCenterArr',$ZhengcheCenterArr);
		$this->assign('FenxiCenterArr',$FenxiCenterArr);
		$this->assign('BaodaoRightArr',$BaodaoRightArr);


		$this->assign('DongtaiSixArr',$DongtaiSixArr);
		$this->assign('TupianSixArr',$TupianSixArr);
		$this->assign('DaogouSixArr',$DaogouSixArr);
		$this->assign('ZhishiSixArr',$ZhishiSixArr);

		$this->assign('DongtaiTenArr',$DongtaiTenArr);
		$this->assign('TupianTenArr',$TupianTenArr);
		$this->assign('DaogouTenArr',$DaogouTenArr);
		$this->assign('ZhishiTenArr',$ZhishiTenArr);

		$this->assign('HangyeHotRightTArr',$HangyeHotRightTArr);

		
		$this->assign('RandOneArr',$RandOneArr);
		$this->assign('XinwenCenterArr',$XinwenCenterArr);
		$this->assign('QiyeCenterArr',$QiyeCenterArr);


		$this->assign('TenProductArr',$TenProductArr);
		$this->assign('FourProductArr',$FourProductArr);

		$keys = explode(',',$seo_Arr);
		
		$SEO['title'] ='建材行业最新最及时的建材资讯,新闻,行业动态, 政策法规综合信息平台-都市家建材网';
		$SEO['keywords'] =  '都市家建材网,建材网,建材网站,建材新闻,建材资讯,建材政策法规';
		$SEO['description'] = '都市家建材网提供专业且全面的建材产品供求信息,主要信息包含:建材产品的报价,建材产品的品牌,建材产品的招商，加盟以及建材代理信息,为广大建材行业的个人与企业同行们，提供海量的建材信息与商机，努力打造成中国最全的建材种类行业门户网站.';

		$this->assign('SEO',$SEO);// SEO相关

		$this->display(); // 输出模板

    }

	 public function show(){
		echo '@@@@';exit;
	 }



}